#加法
import cv2
import numpy as np
img = cv2.imread("shuangzi.png")
img_resized = cv2.resize(img, (400, 550))
m = np.ones(img_resized.shape, dtype="uint8") * 100
result = cv2.add(img_resized, m)
cv2.imshow("yuantu", img_resized)
cv2.imshow("jiayuansuanhou", result)
cv2.waitKey(0)
cv2.destroyAllWindows()

#减法
import cv2
import numpy as np
img = cv2.imread("shuangzi.png")
img_resized = cv2.resize(img, (400, 550))
m = np.ones(img_resized.shape, dtype="uint8") * 100
result = cv2.subtract(img_resized, m)
cv2.imshow("yuantu", img_resized)
cv2.imshow("jiayuansuanhou", result)
cv2.waitKey(0)
cv2.destroyAllWindows()

#与运算
import cv2
img =cv2.imread("kong.jpg")
img_resized = cv2.resize(img,(400,400))
cv2.imshow("showing",img_resized)
cv2.waitKey(0)
circle_img = cv2.imread("ying.jpg")
circle_img_resized = cv2.resize(circle_img,(400,400))
cv2.imshow("circle_image",circle_img_resized)
cv2.waitKey(0)
result_and = cv2.bitwise_and(img_resized, circle_img_resized)
cv2.imshow("showing_and", result_and)
cv2.waitKey(0)


#执行或运算
result_or =cv2.bitwise_or(img_resized,circle_img_resized)
cv2.imshow("showing_or",result_or)
cv2.waitKey(0)

#执行非运算

result_not_1 = cv2.bitwise_not(img_resized)
cv2.imshow("showing_not_1",result_not_1)
cv2.waitKey(0)
result_not_2 = cv2.bitwise_not(circle_img_resized)
cv2.imshow("showing_not_2", result_not_2)
cv2.waitKey(0)
cv2.destroyAllWindows()